package com.aididi.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

/**
 * @Auther: zx.xu
 * @Description:    这个服务类将会被controller调用，进行发送消息
 */
@Service
@EnableBinding({MySource.class})
public class SendService {

    @Autowired
    private MySource mySource;


    public void sendMsg(String msg){
        mySource.myOutput().send(MessageBuilder.withPayload(msg).build());
    }

}
